package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.internetofthings.firefightingiot;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot.LEDScreenService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @author Yang
 * LED控制器
 */
@Action
@RequestMapping("fireFightingIOT/LEDScreen")
public class LEDScreenController extends BaseController {
    @Resource
    public LEDScreenService ledScreenService;


    /**
     * @Author YangYu
     * @Description 发布文字xml版
     * @Date Created in 15:13 2021/9/17
     * @Param [jsonParam]
     */

    @At(value = "publishTextXML", method = RequestMethod.POST)
    public RespEntity publishTextXML(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.publishTextXML(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 发布视频
     * @Date Created in 17:47 2021/9/13
     * @Param [jsonParam]
     */

    @At(value = "publishVideo", method = RequestMethod.POST)
    public RespEntity publishVideo(@RequestBody(required = false) JSONObject jsonParam) {
        return ledScreenService.publishVideo(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 发布图片
     * @Date Created in 10:56 2021/11/10
     * @Param [jsonParam]
     */

    @At(value = "publishPicture", method = RequestMethod.POST)
    public RespEntity publishPicture(@RequestBody(required = false) JSONObject jsonParam) {
        return ledScreenService.publishPicture(jsonParam);
    }


    /**
     * @Author YangYu
     * @Description 屏幕截图
     * @Date Created in 17:34 2021/9/13
     *                    截图宽度   截图高度    控制卡条形码
     * @Param [jsonParam：picwidth、picheight、number]
     */

    @At(value = "screenshot", method = RequestMethod.POST)
    public RespEntity instructionEncryption(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.screenshot(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 停止播放
     * @Date Created in 14:38 2021/9/16
     *                   节目类型 控制卡条形码
     * @Param [jsonParam:：type、number]
     */

    @At(value = "stopPlay", method = RequestMethod.POST)
    public RespEntity stopPlay(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.stopPlay(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 播放节目
     * @Date Created in 9:31 2021/9/18
     * @Param [jsonParam]
     */

    @At(value = "play", method = RequestMethod.POST)
    public RespEntity play(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.play(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 查询已上传视频的文件名
     * @Date Created in 16:15 2021/10/11
     * @Param [jsonParam]
     */

    @At(value = "getLedUploadFileList", method = RequestMethod.GET)
    public RespEntity getLedUploadFileList(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.getLedUploadFileList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 删除文件
     * @Date Created in 10:55 2021/11/10
     * @Param [jsonParam]
     */

    @At(value = "delFile", method = RequestMethod.POST)
    public RespEntity delFile(@RequestBody(required = false) JSONObject jsonParam){
        return ledScreenService.delFile(jsonParam);
    }

}
